@import "flat-components/theme/fancy-scrollbar.less";

.preferences-modal {
    height: 80vh;

    .ant-modal-content {
        height: 100%;
        display: flex;
        flex-direction: column;
        border-radius: 8px;
        overflow: hidden;
    }

    .ant-modal-close {
        top: 0;
        right: 0;

        .ant-modal-close-x {
            width: 24px;
            height: 24px;
            line-height: 24px;
            font-size: 12px;
        }
    }

    .ant-modal-header {
        padding: 0;
        text-align: center;
        border: none;
    }

    .ant-modal-title {
        text-align: center;
        font-size: 12px;
        line-height: 2;
        font-weight: 400;
        color: #444e60;
        background: #ececec;
    }

    .ant-modal-body {
        flex: 1;
        padding: 0;
        overflow: hidden;
    }
}

.preferences-modal-content {
    height: 100%;
    display: flex;
}

.preferences-modal-nav {
    width: 200px;
    flex: 0 0 auto;
    border-right: 1px solid var(--grey-1);

    >ul {
        margin: 0;
        padding: 16px 0;
        list-style-type: none;
        display: flex;
        flex-direction: column;
        position: sticky;
        top: 0;
    }

    >ul>li {
        padding: 0 8px;
    }

    >ul>li>a {
        user-select: none;

        svg,
        span {
            pointer-events: none;
        }
    }
}

.preferences-modal-nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0 8px 16px;
    border-radius: 6px;
    color: var(--text);

    &:hover,
    &:active {
        color: var(--primary);
        background-color: #f3f6f9;
    }

    &.is-active {
        color: var(--primary);
        background-color: #3381ff0f;
    }

    &:hover {
        .flat-icon-fill-color {
            fill: currentColor;
        }

        .flat-icon-stroke-color {
            stroke: currentColor;
        }
    }
}

.preferences-modal-body {
    .fancy-scrollbar-mixin();

    flex: 1;
    height: 100%;
}

.preferences-modal-body>hr {
    margin: 0 16px;
    border: none;
    border-bottom: 1px solid var(--grey-1);
}

.preferences-modal-section {
    padding: 16px;
    display: flex;
    flex-direction: column;
    color: var(--text);
}

.preferences-modal-section-title {
    margin: 0 0 16px;
    font-size: 16px;
    line-height: 1.5;
    font-weight: 600;
    color: var(--text-stronger);
}

.preferences-modal-section-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-gap: 16px;
    align-items: center;
}

.preferences-modal-section-grid-content {
    display: flex;
    flex-flow: row wrap;
    gap: 16px;
}

.preferences-modal-section-grid-label {
    white-space: pre-wrap;

    &.first-row {
        align-self: flex-start;
        transform: translateY(calc(60px - 50%));
    }
}

.preferences-modal-section-control {
    max-width: 320px;
}

.preferences-modal-section-checkbox {
    margin-top: 12px;
}

.preferences-modal-section-radio {
    width: 160px;
    height: 120px;
    padding: 90px 0 12px 16px;
    margin-right: 0;
    border-radius: 6px;
    border: 1px solid var(--grey-1);
    overflow: hidden;

    &::before {
        content: '';
        position: absolute;
        left: 0;
        bottom: 0;
        display: block;
        width: 100%;
        height: 38px;
        border-top: 1px solid var(--grey-1);
        z-index: 200;
    }

    &::after {
        position: absolute;
        left: 0;
        bottom: 0;
        display: block;
        width: 100%;
        height: 40px;
        transition: background-color 0.3s ease;
    }

    &.ant-radio-wrapper-checked::after {
        background-color: var(--blue-1);
    }

    .ant-radio,
    .ant-radio+span {
        z-index: 100;
    }

    .ant-radio+span>img {
        position: absolute;
        top: 0;
        left: 0;
        width: 160px;
        pointer-events: none;
    }
}

.preferences-modal-section-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;

    &.default {
        background: linear-gradient(-26.5deg, #000 0% 49%, #fff 50% 100%);
    }

    &.teal {
        background: #064D6D;
    }

    &.grey {
        background: #49585F;
    }

    &.green {
        background: #446550;
    }
}

.preferences-modal-section-front {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    color: #fff;
}

.preferences-modal-section-background.default>.preferences-modal-section-front {
    mix-blend-mode: difference;
}

.preferences-modal-section-theme {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    display: flex;
    padding: 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;

    &.light {
        background: #fff;

        .preferences-modal-section-theme-front {
            background-color: var(--blue-2);
        }
    }

    &.dark {
        background: var(--grey-9);

        .preferences-modal-section-theme-front {
            background-color: var(--grey-7);
        }
    }
}

.preferences-modal-section-theme-front {
    display: inline-block;
    width: 80px;
    height: 8px;

    &:first-child {
        width: 120px;
    }
}

.preferences-modal-section-theme.auto {
    padding: 0;
    display: flex;
    flex-flow: row nowrap;
    gap: 0;

    >.preferences-modal-section-theme {
        position: static;
        flex: 1;

        >.preferences-modal-section-theme-front {
            width: 20px;

            &:first-child {
                width: 40px;
            }
        }
    }
}

.preferences-modal-section-button {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 320px;
    margin-top: 16px;
    padding: 4px 12px;
}

.preferences-modal-section-button-icon-end {
    position: absolute;
    right: 4px;
}

.preferences-modal-hotkey-setting-content {
    .ant-table-header tr>th {
        border: none;
        padding: 16px;
        background: #fff;

        &::before {
            background: none !important;
        }
    }

    .ant-table-thead>tr>th {
        font-weight: normal;
    }

    .ant-table-body {
        overflow-y: hidden !important;
        max-height: initial !important;
        margin-bottom: 36px;
        border: 1px solid var(--grey-1);
        border-radius: 15px;

        .ant-table-thead {
            display: none;
        }

        .ant-table-row[data-row-key="edit1"]>td,
        .ant-table-tbody .ant-table-tbody .ant-table-row>td {
            border-top: 1px solid var(--grey-1);
        }

        .ant-table-tbody>tr>td {
            color: var(--text-strong);
            border: none;
        }
    }

    tr.ant-table-expanded-row>td {
        background-color: #fff !important;
    }

    td.ant-table-cell:nth-child(odd) {
        width: 290px;
    }
}

.flat-color-scheme-dark {
    .preferences-modal {
        .ant-modal-header {
            border-bottom-color: var(--grey-9);
        }

        .ant-modal-title {
            font-size: 12px;
            line-height: 2;
            font-weight: 400;
            color: var(--text);
            background: var(--grey-9);
        }
    }

    .preferences-modal-nav {
        border-right-color: var(--grey-9);
    }

    .preferences-modal-nav-item {
        color: var(--text);

        &:hover {
            background-color: var(--grey-9);
        }

        &:active {
            background-color: var(--grey-11);
        }

        &.is-active {
            color: var(--blue-7);
            background-color: var(--grey-11);
        }
    }

    .preferences-modal-body>hr {
        border-bottom-color: var(--grey-9);
    }

    .preferences-modal-section-radio {
        border-color: var(--grey-7);

        &::before {
            border-color: var(--grey-7);
        }

        &.ant-radio-wrapper-checked::after {
            background-color: var(--grey-9);
        }
    }

    .preferences-modal-hotkey-setting-content {
        .ant-table-header tr>th {
            border: none;
            padding: 10px;
            background: var(--grey-10);
            color: var(--text-strong);
        }

        .ant-table-body {
            border: 1px solid var(--grey-8);

            tr.ant-table-expanded-row>td {
                background-color: var(--grey-10) !important;
            }

            .ant-table-row[data-row-key="edit1"]>td,
            .ant-table-tbody .ant-table-tbody .ant-table-row>td {
                border-top-color: var(--grey-8);
            }
        }

        .ant-table-row-expand-icon {
            background-color: var(--grey-10);
            border-color: var(--grey-8);
        }
    }
}
